#include<iostream>
using namespace std;
typedef long long LL;
//
LL qpow(LL x, LL y)
{
	LL ret = 1;
	while (y)
	{
		if (x > 1e9) return -1;
		if (y & 1) ret = ret * x;

		if (ret > 1e9) return -1;
		y >>= 1;
		x = x * x;
	}
	return ret;
}
int main()
{
	LL x = 0; LL y = 0;
	cin >> x >> y;
	LL ret=qpow(x, y);
	cout << ret << endl;
	return 0;
}